<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>商务谈判-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mui.picker.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
    <a class="menu_btn" href="javascript:;"><span class="sp1"></span><span class="sp2"></span><span class="sp3"></span></a>
	商务谈判<a href="__APP__/Mobile/Project/project_negotiation/id/{$project['id']}" class="header_txt_btn">取消</a>
</div>
<include file="Include:commu_menu" />
<div class="content">
    <div class="communicate_add" style="padding-bottom:64px;">
        <form name="number_validate">
            <div class="form_item">
                <div class="form_item_tit">
                    人员及日期
                </div>
                <div class="form_item_box">
                    <ul class="choice_list">
                        <li class="name_li"><input id="name" class="text_input" name="name" type="text" mid="" readonly placeholder="请选择客户…"></li>
                        <li class="data_li"><input id="data" class="text_input" name="data" type="text" readonly placeholder="请选择日期…"></li>
                        <li class="pep_li"><p>请选择考察/接待人员…</p><input type="hidden" name="kc_name"></li>
                    </ul>
                </div>
                <div class="form_item_tit">
                    工作类别
                </div>
                <div class="form_item_box label_box">
                    <label class="form_label w50b checkbox"><input type="checkbox" name="type[]" value="考察">考察</label><label class="form_label w50b checkbox"><input type="checkbox" name="type[]" value="接待">接待</label><label class="form_label w50b checkbox"><input type="checkbox" name="type[]" value="电话沟通">电话沟通</label><label class="form_label w50b checkbox"><input type="checkbox" name="type[]" value="计划书沟通">计划书沟通</label><label class="form_label w50b checkbox"><input type="checkbox" name="type[]" value="合同沟通">合同沟通</label><label class="form_label w50b checkbox2 jy_btn"><input type="checkbox" name="js_choice" disabled><span>工作建议书</span></label>
                    <input class="other_text" name="remark_text" type="text" placeholder="其它…">
                </div>
                <div class="form_item_tit">
                    沟通备忘录
                </div>
                <div class="form_item_box label_box">
                    <textarea class="text_input" name="content" placeholder="点击填写沟通备忘录…"></textarea>
                </div>
            </div>
            <div class="build_btn paddbox"><div><button type="button" class="sub_btn main_sub disabled" disabled>提 交</button></div></div>
        </form>
    </div>
</div>
<!-- 弹出框 -->
<div class="white_alert tit_alert tit_alert1" style="display: none;">
    <div class="tit">考察/接待人员</div>
    <ul class="alert_list">
		<foreach name="user_list" item="do">
			<foreach name="do['user']" item="uo">
				<li cid="{$uo['id']}">{$uo['username']}</li>
			</foreach>
		</foreach>
    </ul>
    <div class="clearboth">
        <a class="modal_close2" href="javascript:;">取消</a>
        <a class="modal_sub float_r" href="javascript:;">确定</a>
    </div>
</div>
<!-- 弹出框 -->
<div class="Mask"></div>
<div class="white_alert tit_alert tit_alert2" style="display: none;">
    <div class="tit">工作建议书</div>
    <if condition="$project_bg['project_uids'] neq NULL">
        <ul class="alert_list">
            <foreach name="result1" item="vo">
                <li tid="{$vo['id']}">{$vo['username']}</li>
            </foreach>
        </ul>
    <else/>
        <div class="mb15" style="line-height: 30px">请先选择启动表项目人员</div>
        
    </if>
    <div class="clearboth">
        <a class="modal_close2" href="javascript:;">取消</a>
        <a class="modal_sub float_r" href="javascript:;">确定</a>
    </div>
</div>
<!-- 弹出框 -->
<div class="card_fix">
    <div class="tit"><a class="back_btn" href="javascript:;"></a>添加客户</div>
    <div class="modal_body">

    </div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script src="__PUBLIC__/mobile/js/mui.min.js"></script>
<script src="__PUBLIC__/mobile/js/mui.picker.min.js"></script>
<script>
    var provinces = {$customers};
    
    $(function(){
        menu();
        $('.modal_close2').click(function(){
            $(this).parents('.white_alert').fadeOut();
            $('.Mask').fadeOut();
        });
        $("#name").CityPicker();
        //添加
        $('body').on("click",".add_btn",function(){
            $(".picker-box").fadeOut();
            $('.search_li li').hide();
            $('.search_result').hide();
            $('.search_inp input').val('');
            $('.card_fix').fadeIn().find('.modal_body').load("__APP__/Mobile/Project/project_card_add/pid/{$project['id']}/way/2/since/2/center_id/130003");
            $('.card_fix').fadeIn().find('.tit').html('<a class="back_btn" href="javascript:;"></a>添加客户')
        })
        //人员
        $(".pep_li p").click(function(){
            $(".Mask,.tit_alert1").fadeIn();
        })
        $(".tit_alert1 li").click(function(){
            $(this).toggleClass('active');
            if($(".tit_alert1 li.active").length>0){
                $(".tit_alert1 .modal_sub").removeClass('disabled');
            }
        })
        $(".tit_alert1 .modal_sub").click(function(){
            var html ='',
                idhtml ='',
                active = $(".tit_alert1 li.active");
            for(var i = 0; i<active.length;i++){
                var txt = active.eq(i).text(),
                    cid = active.eq(i).attr('cid');
                html+= ""+txt+"";
                if(i<active.length-1){
                    html+= ",";
                }
                idhtml+= ""+cid+"";
                if(i<active.length-1){
                    idhtml+= ",";
                }
            }
            $(".pep_li p").html(html);
            $(".pep_li p").addClass('active');
            $(".pep_li input").change();
            $(".pep_li input").attr('cid',idhtml);
            $(".tit_alert1").fadeOut();
            $('.Mask').fadeOut();
            if($('.alert_list .active').length<1){
                $(".pep_li p").html('请选择考察/接待人员…');
                $(".pep_li p").removeClass('active');
            }
        })
        //建议书
        $(".jy_btn").click(function(){
            $(".Mask,.tit_alert2").fadeIn();
        })
        $(".tit_alert2 li").click(function(){
            $(this).toggleClass('active').siblings().removeClass('active');
        })
        $(".tit_alert2 .modal_sub").click(function(){
            var txt = $(".tit_alert2 li.active").text(),
                tid = $(".tit_alert2 li.active").attr('tid');
            if($(".tit_alert2 li.active").length>0){
                $(".jy_btn span").html("工作建议书-"+txt+"");
                $(".checkbox2").addClass('active');
                $(".checkbox2").find('input').prop("checked",true);
                $("[name='js_choice']").attr('tid',tid);
            }else{
                $("[name='js_choice']").attr('tid','');
                $(".jy_btn span").html("工作建议书");
                $(".checkbox2").removeClass('active');
                $(".checkbox2").find('input').prop("checked",false);
            }
            $(".tit_alert2").fadeOut();
            $('.Mask').fadeOut();
            submit();
        })

        $(".checkbox").click(function(){
            submit();
        })
        $("[name='data'],[name='name']").change(function(){
            submit();
        })
        $("[name='content'],[name='remark_text']").blur(function(){
            submit();
        })
        //日历
        $('#data').mobiscroll().date({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });
        //提交
        function submit(){
            var tag = true;

            $('.text_input').each(function(){
                var val = $(this).val();
                if(val==''){
                    tag = false;
                    $('.sub_btn').addClass('disabled').attr('disabled',true);
                }
            })
            if($("[name='remark_text']").val()==''){
                if($(".form_label input:checked").length==0){
                    tag = false;
                    $('.sub_btn').addClass('disabled').attr('disabled',true);
                }
            }
            if(tag){
                $('.sub_btn').removeClass('disabled').attr('disabled',false);
            }
        }
		$(".main_sub").click(function(){
            var negotiation_add = 'negotiation_add',
                pid = "{$project['id']}",
                cid = $("[name='kc_name']").attr('cid'),
                tid = $("[name='js_choice']").attr('tid'),
                mid = $("#name").attr('mid');
			if(cid){
				var zcid = cid;
			}else{
				var zcid = '';
			}
			if(mid){
				var zmid = mid;
			}else{
				var zmid = '';
			}
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:$("[name='number_validate']").serialize()+"&action="+negotiation_add+"&pid="+pid+"&cid="+zcid+"&tid="+tid+"&mid="+zmid,
				url:"__APP__/Mobile/Project/stage_ajax",
				success:function(data){
					success_pop(data.status,data.msg,1,'__APP__/Mobile/Project/project_negotiation/id/'+"{$project['id']}");
				}
			});
        })
    })
	
    function bg_che(){
        $('.bg_li p').hide();
		var val_arr=$("[name='name']").val().split('【');
		var	val=val_arr[0],
            mid = $("[name='name']").attr('mid');
        $('.bg_li').addClass('active').find('.span').append("<span><a href='javascript:;'></a><input type='text' readonly value='"+val+"''><input name='hide_val[]' type='hidden' value='"+mid+"'></span>");
    }
    function remove(){
        
    }
</script>
<script src="__PUBLIC__/mobile/js/cityPicker.js"></script>
</body>
</html>